<template>
	<div>
		<aplid-base-crud ref="crud" class="w-100" v-bind="theConfig" :paramsObj="params"> </aplid-base-crud>
	</div>
</template>

<script setup lang="ts">
import { baseConfig } from './config'
import { editConfig } from '@/views/datacenter/comprehensiveQueries/utils/index'
type Props = {
	ifShowSearch?: any
	isWithAuth?: any
	isComprehensiveQueries?: boolean
}
const props = withDefaults(defineProps<Props>(), {
	ifShowSearch: true,
	isWithAuth: undefined,
	isComprehensiveQueries: false,
})
let params = reactive({
	code: 3002,
	isWithAuth: props.isWithAuth,
})

let theConfig: any = ref({})

if (baseConfig) {
	let defaultConfig = JSON.parse(JSON.stringify(baseConfig))
	if (props.isComprehensiveQueries) {
		theConfig.value = editConfig(defaultConfig)
	} else {
		if (props.ifShowSearch) {
			theConfig.value = baseConfig
		} else {
			defaultConfig.searchConfig = undefined
			defaultConfig.auth.import = undefined
			defaultConfig.auth.mulitSet = undefined
			theConfig.value = defaultConfig
		}
	}
}
// const crudConfig = computed(() => {
// 	let tempConfig = { ...baseConfig }
// 	if (!props.ifShowSearch) {
// 		tempConfig.searchConfig = undefined
// 		tempConfig.auth.import = undefined
// 		tempConfig.auth.mulitSet = undefined
// 	}
// 	return tempConfig
// })
</script>
<style scoped lang="scss"></style>
